<template>
	<view>
		<cu-custom :bgColor="'bg-' + theme.backgroundColor" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">钱包</block>
		</cu-custom>
		<view>
			<view class="qb-ye text-center p-all50 bg-white m-all20 border-r">
				<view class="f70 text-price text-red">{{ userInfo.money }}</view>
				<view class="f40 mt30">当前余额 </view>
			</view>
			<view class="tools bg-white border-r m-all20 p-all20">
				<view
					class="item text-center"
					v-for="(item, index) in tools"
					:key="index"
					@tap.stop="$goUrl(item.url)">
					<view class="f60 mb10 text-red" :class="item.icon"></view>
					<view class="f36">{{ item.label }}</view>
				</view>
			</view>
		</view>
	</view>
</template>
<script>
const app = getApp();
import api from "utils/api";

export default {
	data() {
		return {
			theme: app.globalData.theme,
			tools: [
				{
					label: "充值",
					icon: "cuIcon-redpacket",
					url: "/pages/purse/recharge",
				},
				// {
				// 	label: "提现",
				// 	icon: "cuIcon-card",
				// 	url: "/pages/purse/withdraw",
				// },
				{
					label: "充值记录",
					icon: "cuIcon-formfill",
					url: "/pages/purse/recharge-record",
				},
				{
					label: "提现记录",
					icon: "cuIcon-text",
					url: "/pages/purse/withdraw-record",
				},
			],
			userInfo: {},
		};
	},
	onLoad(options) {
		this.userInfoGet();
	},
	methods: {
		userInfoGet() {
			api.userInfoGet().then((res) => {
				this.userInfo = res.data;
			});
		},
	},
};
</script>
<style lang="scss" scoped>
.tools {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	.item {
		width: 33%;
	}
}
</style>
